Skip to content

VPLAY-12682:SoC-independent underflow detection - follow-up improvements#1024

Open
varshnie wants to merge 3 commits intodev_sprint_25_2from
feature/VPLAY-12682
Open

VPLAY-12682:SoC-independent underflow detection - follow-up improvements#1024
varshnie wants to merge 3 commits intodev_sprint_25_2from
feature/VPLAY-12682

Conversation

@varshnie
Copy link
Contributor

Reason for change:follow-up improvements for AampUnderflowMonitor
Risks: Medium

Signed-off-by: varshnie varshniblue14@gmail.com

@varshnie varshnie requested a review from a team as a code owner February 13, 2026 05:41
Copilot AI review requested due to automatic review settings February 13, 2026 05:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements follow-up improvements to the AampUnderflowMonitor feature, focusing on lifecycle management changes and code simplification. However, the PR introduces critical thread-safety issues by removing mutex protections that were essential for safe concurrent access.

Changes:

  • Moved AampUnderflowMonitor initialization from lazy creation in StartUnderflowMonitor to eager creation in StreamAbstractionAAMP constructor
  • Removed mUnderflowMonitorMutex from StreamAbstractionAAMP class and all lifecycle method synchronization
  • Cached raw pointers in AampUnderflowMonitor::Run() method to avoid repeated mutex locking
  • Renamed parameter from bufferingStopped to bufferingStart for clarity
  • Added config check wrapper around SetBufferingState logic
  • Moved StartUnderflowMonitor calls from central TuneHelper to protocol-specific Start() methods

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
streamabstraction.cpp Moved monitor initialization to constructor; removed mutex protections from lifecycle methods; simplified StartUnderflowMonitor
StreamAbstractionAAMP.h Removed mUnderflowMonitorMutex member variable
priv_aamp.h Renamed parameter bufferingStopped to bufferingStart in SendBufferChangeEvent
priv_aamp.cpp Updated parameter name; added ReportBufferEvent config check wrapping SetBufferingState logic; removed monitor startup from TuneHelper
AampUnderflowMonitor.h Removed @fn tags from Doxygen comments
AampUnderflowMonitor.cpp Cached mAamp and mStream pointers locally in Run(); removed mutex protections from multiple pointer accesses
fragmentcollector_progressive.cpp Added StartUnderflowMonitor call to protocol-specific Start() method
fragmentcollector_mpd.cpp Added StartUnderflowMonitor call to protocol-specific Start() method
fragmentcollector_hls.cpp Added StartUnderflowMonitor call to protocol-specific Start() method
AampConfig.cpp Added documentation comment for enableAampUnderflowMonitor config option
Comments suppressed due to low confidence (1)

streamabstraction.cpp:3043

  • Missing synchronization: The removal of the mutex lock from StopUnderflowMonitor creates a race condition with StartUnderflowMonitor and IsUnderflowMonitorRunning(). Without the mutex, concurrent access to mUnderflowMonitor (checking, calling methods, and resetting) is not thread-safe.

Re-introduce the mUnderflowMonitorMutex to protect access to mUnderflowMonitor in all three lifecycle methods.

	if (mUnderflowMonitor)
	{
		mUnderflowMonitor->Stop();
		mUnderflowMonitor.reset();
		AAMPLOG_INFO("Stopped AampUnderflowMonitor for video");
	}

@varshnie varshnie force-pushed the feature/VPLAY-12682 branch from 58f23ec to 025049b Compare February 13, 2026 11:54
Copilot AI review requested due to automatic review settings February 13, 2026 14:48
@varshnie varshnie force-pushed the feature/VPLAY-12682 branch from 025049b to 861853a Compare February 13, 2026 14:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

@varshnie varshnie force-pushed the feature/VPLAY-12682 branch from 861853a to a35fd92 Compare February 13, 2026 16:27
Copilot AI review requested due to automatic review settings February 13, 2026 17:26
@varshnie varshnie force-pushed the feature/VPLAY-12682 branch from a35fd92 to dea5fb9 Compare February 13, 2026 17:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

@varshnie varshnie force-pushed the feature/VPLAY-12682 branch from dea5fb9 to 0f5d441 Compare February 13, 2026 17:44
Copilot AI review requested due to automatic review settings February 17, 2026 09:48
@varshnie varshnie force-pushed the feature/VPLAY-12682 branch from 0f5d441 to 70b421a Compare February 17, 2026 09:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

@varshnie varshnie force-pushed the feature/VPLAY-12682 branch from 70b421a to 799335c Compare February 17, 2026 13:38
Copilot AI review requested due to automatic review settings February 22, 2026 18:17
@varshnie varshnie force-pushed the feature/VPLAY-12682 branch from 799335c to 700053b Compare February 22, 2026 18:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 7 comments.

@varshnie varshnie force-pushed the feature/VPLAY-12682 branch from 700053b to 2bd4db9 Compare February 22, 2026 19:15
Copilot AI review requested due to automatic review settings February 24, 2026 12:55
@varshnie varshnie force-pushed the feature/VPLAY-12682 branch from 2bd4db9 to 12bfdcf Compare February 24, 2026 12:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.

@varshnie varshnie force-pushed the feature/VPLAY-12682 branch from dc36a2a to 96f202d Compare February 24, 2026 13:10
Copilot AI review requested due to automatic review settings February 24, 2026 13:14
@varshnie varshnie force-pushed the feature/VPLAY-12682 branch from 96f202d to 739b3b0 Compare February 24, 2026 13:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated 6 comments.

@varshnie varshnie force-pushed the feature/VPLAY-12682 branch from 739b3b0 to 0e89ff1 Compare February 24, 2026 17:20
Copilot AI review requested due to automatic review settings February 24, 2026 18:09
@varshnie varshnie force-pushed the feature/VPLAY-12682 branch from 0e89ff1 to b1f7e34 Compare February 24, 2026 18:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

test/utests/fakes/FakeAampUnderflowMonitor.cpp:54

  • This fake file defines the production AampUnderflowMonitor methods (ctor/dtor/Start/Stop/Run). Because the fakes library is linked by most unit test executables, any test that also compiles the real AampUnderflowMonitor.cpp will hit ODR / multiple-definition linker failures. Consider renaming this to a separate fake class (instead of redefining AampUnderflowMonitor), or moving it out of the always-linked fakes library so only specific tests override the implementation.
#include "AampUnderflowMonitor.h"
#include "MockAampUnderflowMonitor.h"

MockAampUnderflowMonitor *g_mockAampUnderflowMonitor = nullptr;

AampUnderflowMonitor::AampUnderflowMonitor(StreamAbstractionAAMP* stream, PrivateInstanceAAMP* aamp) : mStream(stream), mAamp(aamp)
{
}

AampUnderflowMonitor::~AampUnderflowMonitor()
{
}

void AampUnderflowMonitor::Start()
{
    mRunning.store(true);
    if(g_mockAampUnderflowMonitor != nullptr)
    {
        g_mockAampUnderflowMonitor->Start();
    }
}

void AampUnderflowMonitor::Stop()
{
    mRunning.store(false);
    if(g_mockAampUnderflowMonitor != nullptr)
    {
        g_mockAampUnderflowMonitor->Stop();
    }
}

void AampUnderflowMonitor::Run()
{
}

@varshnie varshnie force-pushed the feature/VPLAY-12682 branch from b1f7e34 to 1e51788 Compare February 26, 2026 10:45
Copilot AI review requested due to automatic review settings February 28, 2026 06:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings March 2, 2026 15:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

StreamAbstractionAAMP.h:2042

  • mUnderflowMonitor is a std::unique_ptr that is started/stopped and also reset in the implementation, and the class-level mutex that previously serialized these operations was removed. Given the monitor pointer can now be reset, this member needs explicit synchronization (or a stable lifetime guarantee) to avoid races when accessed from multiple threads via the public Start/Stop/IsRunning wrappers.
protected:
	/**
	 * Underflow monitor instance owned by Stream; manages detection and
	 * handling of underflow conditions.
	 */
	std::unique_ptr<class AampUnderflowMonitor> mUnderflowMonitor;

varshnie and others added 3 commits March 3, 2026 23:36
Reason for change:follow-up improvements for AampUnderflowMonitor
Risks: Medium

Signed-off-by: varshnie <varshniblue14@gmail.com>

VPLAY-12605:[L1 Test] AampUnderflowMonitor Tests

Reason for change:Added L1 for AampUnderflowMonitor
Test Procedure:Refer Jira Ticket
Risks: Medium

Signed-off-by: varshnie <varshniblue14@gmail.com>

Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tionAAMP without stopping the underflow monitor first.

Signed-off-by: Philip Stroffolino <philip_stroffolino@cable.comcast.com>
@varshnie varshnie force-pushed the feature/VPLAY-12682 branch from 8fdc204 to 57735dc Compare March 3, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants